// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();//注意，不是wx.cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
	const wxContext = cloud.getWXContext()//目的：获取_openid, wxContext.OPENID
	try {
		return await db.collection("homeInfo").doc("info").update({
			data: {
				"image": event.image,
				"content": event.content
			}, success: res => {
				console.log("云函数 成功")
			}, fail: err => {
				console.log("云函数 失败")
			}
		})
	} catch (e) {
		console.log(e)
	}
}